/**
 *
 * Copyright 2015 RSVP Technologies Inc. All rights reserved.
 * Scheme.java
 *
 */
package com.gfinal.map.direction;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.gfinal.map.place.Location;

/**
 * 公交路线
 * 
 * @author Gao Yudong (gyd@nbicc.com)
 * @date 2015-3-2
 */
public class Scheme implements Serializable {
	private static final long serialVersionUID = -2823872218502553183L;

	/**
	 * 预计到达时间
	 */
	private String arrive_time = null;

	/**
	 * 路段距离
	 */
	private int distance = 0;

	/**
	 * 路段耗时
	 */
	private int duration = 0;

	/**
	 * 分段票价
	 */
	private List<LinePrice> line_price = new ArrayList<LinePrice>();

	/**
	 * ???
	 */
	private int plan_trans_type = 0;

	/**
	 * 总票价
	 */
	private int price = 0;

	private String tip_label = null;

	private String tip_label_background = null;

	private int tip_label_type = 0;

	private int traffic_type = 0;

	/**
	 * 起点经纬度坐标
	 */
	private Location originLocation = null;

	/**
	 * 终点经纬度坐标
	 */
	private Location destinationLocation = null;

	/**
	 * 路段
	 */
	private List<ArrayList<TransitStep>> steps = new ArrayList<ArrayList<TransitStep>>();

	public Scheme() {
		super();
	}

	public String getArrive_time() {
		return arrive_time;
	}

	public void setArrive_time(String arrive_time) {
		this.arrive_time = arrive_time;
	}

	public int getDistance() {
		return distance;
	}

	public void setDistance(int distance) {
		this.distance = distance;
	}

	public int getDuration() {
		return duration;
	}

	public void setDuration(int duration) {
		this.duration = duration;
	}

	public List<LinePrice> getLine_price() {
		return line_price;
	}

	public void setLine_price(List<LinePrice> line_price) {
		this.line_price = line_price;
	}

	public int getPlan_trans_type() {
		return plan_trans_type;
	}

	public void setPlan_trans_type(int plan_trans_type) {
		this.plan_trans_type = plan_trans_type;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public String getTip_label() {
		if(tip_label != null) {
			String regEx_html = "<[^>]+>";
			Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
			Matcher m_html = p_html.matcher(tip_label);
			tip_label = m_html.replaceAll("");
		}
		return tip_label;
	}

	public void setTip_label(String tip_label) {
		this.tip_label = tip_label;
	}

	public String getTip_label_background() {
		return tip_label_background;
	}

	public void setTip_label_background(String tip_label_background) {
		this.tip_label_background = tip_label_background;
	}

	public int getTip_label_type() {
		return tip_label_type;
	}

	public void setTip_label_type(int tip_label_type) {
		this.tip_label_type = tip_label_type;
	}

	public int getTraffic_type() {
		return traffic_type;
	}

	public void setTraffic_type(int traffic_type) {
		this.traffic_type = traffic_type;
	}

	public Location getOriginLocation() {
		return originLocation;
	}

	public void setOriginLocation(Location originLocation) {
		this.originLocation = originLocation;
	}

	public Location getDestinationLocation() {
		return destinationLocation;
	}

	public void setDestinationLocation(Location destinationLocation) {
		this.destinationLocation = destinationLocation;
	}

	public List<ArrayList<TransitStep>> getSteps() {
		return steps;
	}

	public void setSteps(List<ArrayList<TransitStep>> steps) {
		this.steps = steps;
	}
	
	@Override
	public String toString() {
		return "Scheme [arrive_time=" + arrive_time + ", distance=" + distance
				+ ", duration=" + duration + ", line_price=" + line_price
				+ ", plan_trans_type=" + plan_trans_type + ", price=" + price
				+ ", tip_label=" + tip_label + ", tip_label_background="
				+ tip_label_background + ", tip_label_type=" + tip_label_type
				+ ", traffic_type=" + traffic_type + ", originLocation="
				+ originLocation + ", destinationLocation="
				+ destinationLocation + ", steps=" + steps + "]";
	}

	class LinePrice implements Serializable {
		private static final long serialVersionUID = 5593058478734177922L;

		/**
		 * 价格 单位：分
		 */
		private int line_price = 0;

		/**
		 * 票类型 0：公交票价；1：地铁票价
		 */
		private int line_type = 0;

		public LinePrice() {
			super();
		}

		public int getLine_price() {
			return line_price;
		}

		public void setLine_price(int line_price) {
			this.line_price = line_price;
		}

		public int getLine_type() {
			return line_type;
		}

		public void setLine_type(int line_type) {
			this.line_type = line_type;
		}

		@Override
		public String toString() {
			return "LinePrice [line_price=" + line_price + ", line_type="
					+ line_type + "]";
		}

	}
}
